
<style lang="less">
@import '../../../styles/common.less';
</style>
<!--  线下催收管理基本页信息-->
<template>
  <Row>
    <header>
      <Form action="" method="get" name="exportList" id="exportList" enctype="multipart/form-data">
        <Row style="margin-top:20px">
          <span style="width: 200px;margin-left: 15px;">姓名：</span>
          <Input v-model="custName" style="width: 150px" name="custName" />
          <span style="width: 200px;margin-left: 15px;">身份证号：</span>
          <Input v-model="custCardNo" style="width: 150px" name="custCardNo" />
          <span style="width: 200px;margin-left: 15px;">手机号：</span>
          <Input v-model="mobile" style="width: 150px" name="mobile" />
          <span style="width: 200px;margin-left: 15px;">贷款产品：</span>
          <Select v-model="productCode" class="v-select-wrapper" style="width:150px" name="productCode">
            <Option v-for="item in productList" :value="item.productType" :key="item.productType">{{ item.productTypeName }}</Option>
          </Select>
        </Row>
        <Row style="margin-top:20px">
          <span style="width: 200px;margin-left: 15px;">逾期天数：</span>
          <Input v-model="overdueCurrentTotalDay" style="width: 150px" name="overdueCurrentTotalDay" />
          <span style="width: 200px;margin-left: 15px;">逾期类型：</span>
          <Select v-model="overdueDays" class="v-select-wrapper" style="width:150px" name="overdueDays">
            <Option v-for="item in overdueDaysList" :value="item.overdueTypeCode" :key="item.overdueTypeCode">{{item.overdueTypeName}}</Option>
          </Select>

          <!-- <span style="width: 200px;margin-left: 15px;">最近一次行动结果：</span>
          <Select v-model="lastActionResultCode" class="v-select-wrapper" style="width:150px" name="lastActionResultCode">
            <Option v-for="item in lastActionResultList" :value="item.actionStatusCode" :key="item.actionStatusCode">{{item.actionStatusDescp}}</Option>
          </Select> -->
          <span style="width: 200px;margin-left: 15px;">分案时间：</span>
          <DatePicker v-model="assignStrDate" type="date" style="width: 150px" name="assignStrDate"></DatePicker>
          <span>至</span>
          <DatePicker v-model="assignEndDate" type="date" placement="bottom-end" style="width: 150px" name="assignEndDate"></DatePicker>
          <Button type="primary" @click="collect" style="margin-left: 10px;">搜索</Button>
          <Button type="primary" @click="reset" style="margin-left: 10px;">重置</Button>
        </Row>
        <Row style="margin-top:20px">
            <input type="hidden" name="pageNum" id="pageNum" v-model="pageNum" />
            <input type="hidden" name="pageSize" id="pageSize" v-model="pageSize" />
        </Row>
      </Form>
    </header>
    <div>
      <Table border :columns="orderColumns" :data="orderData" style="width: 100%;"></Table>
    </div>

  </Row>
</template>

<script>

export default {

  data () {
    return {
      $ajax: null,
      custName: null,
      custCardNo: null,
      mobile: null,
      productCode: '',
      overdueCurrentTotalDay: null,
      overdueDays: '',
      lastActionCode: '',
      lastActionResultCode: '',
      assignStrDate: null,
      assignEndDate: null,
      totalNumber: 0, // 总记录数
      pageNum: 1, // 当前页码
      pageSize: 20, // 页大小
      orderColumns: [
        {
          type: 'index',
          title: '序号',
          width: 60
        },
        {
          title: '借款人',
          key: 'custName',
          align: 'center',
          render: (h, params) => {
            const vm = this
            return h('div', {
              on: {
                click () {
                  vm.$router.push({
                    name: 'collection-deal-compent',
                    query: {
                      custCardNo: params.row.custCardNo,
                      loanId: params.row.loanId,
                      overdueCaseId: params.row.overdueCaseId,
                      overdueType: 0,
                      type: 1,
                      collapseCotrol: false
                    }
                  })
                }
              },
              style: {
                'color': '#20a0ff',
                'cursor': 'pointer'
              }
            }, params.row.custName)
          }
        },
        {
          title: '逾期天数',
          key: 'overdueCurrentTotalDay',
          align: 'center'
        },
        {
          title: '贷款产品',
          key: 'productName',
          align: 'center'
        },
        {
          title: '分案时间',
          key: 'assignDate',
          align: 'center',
          render: (h, params) => {
            var vm = this
            return h('div', [
              h('span', vm.$util.loanModularFormatTime(params.row.assignDate))
            ])
          }
        },

        {
          title: '最近一次行动结果',
          key: 'lastActionResultName',
          align: 'center'
        },
        {
          title: '最近一次行动时间',
          key: 'lastActionTime',
          align: 'center',
          render: (h, params) => {
            var vm = this
            return h('div', [
              h('span', vm.$util.loanModularFormatTime(params.row.lastActionTime))
            ])
          }
        },
        {
          title: '逾期类型',
          key: 'assignOverdueTypeCode',
          align: 'center'
        }

      ],
      orderData: [],
      productList: [],
      lastActionResultList: [],
      overdueDaysList: []
    }
  },
  computed: {
    avatorImage () {
      return localStorage.avatorImgPath
    }
  },

  created () {
    // 初始化当前页面请求对象实例
    this.$ajax = this.$util.ajax()
    // var vm = this
    this.initPage()
  },

  methods: {
    initPage () {
      this.collect()
    },
    collect () {
      var vm = this
      var params = {
        // path: this.$route.path,
        custName: vm.custName,
        custCardNo: vm.custCardNo,
        mobile: vm.mobile,
        productCode: vm.productCode,
        overdueCurrentTotalDay: vm.overdueCurrentTotalDay,
        overdueDays: vm.overdueDays,
        lastActionResultCode: vm.lastActionResultCode,
        assignStrDate: vm.assignStrDate,
        assignEndDate: vm.assignEndDate,
        lastActionCode: vm.lastActionCode
      }
      this.$ajax.post(vm.$appContext.marvels_core_debtor + 'debtor/general/collectionManagement/service/collectCondition', params).then(re => {
        var data = re.data.data
        vm.productList = []
        vm.productList.push({ 'productType': '', 'productTypeName': '请选择' })
        for (var productLength = 0; productLength < data.productList.length; productLength++) {
          vm.productList.push(data.productList[productLength])
        }
        vm.overdueDaysList = []
        vm.overdueDaysList.push({ 'overdueTypeCode': '', 'overdueTypeName': '请选择' })
        for (var riskLength = 0; riskLength < data.voerList.length; riskLength++) {
          vm.overdueDaysList.push(data.voerList[riskLength])
        }
        vm.lastActionResultList = []
        vm.lastActionResultList.push({ 'actionStatusCode': '', 'actionStatusDescp': '请选择' })
        for (var lastLength = 0; lastLength < data.actionReultList.length; lastLength++) {
          vm.lastActionResultList.push(data.actionReultList[lastLength])
        }
        vm.orderData = []
        vm.orderData = data.caseList
      }).catch(er => {

      })
    },
    reset () {
      this.custName = ''
      this.custCardNo = ''
      this.mobile = ''
      this.productCode = ''
      this.overdueCurrentTotalDay = ''
      this.overdueDays = ''
      this.lastActionResultCode = ''
      this.assignStrDate = ''
      this.assignEndDate = ''
    }

  }

}
</script>
